<template>
  <view class="book-result-page" :style="{ 'padding-top': vuex_phoneInfo.statusBarHeight + 35 + 'px' }">
    <image class="banner" src="https://cdc-file.risechina.com/img/2021/11/1635760381975.png" mode="widthFix"></image>
		<view class="user-info">
			<text>{{ vuex_userInfo.name }} {{ vuex_userInfo.sex ===  0 ? '先生' : '女士'}}</text>
			<text>{{ vuex_sessionInfo.session_date }}</text>
			<text>{{ vuex_sessionInfo.session_time }}</text>
			<image class="address" src="https://cdc-file.risechina.com/img/2021/11/1635760428099.png" mode="widthFix" @click="goMap"></image>
		</view>
  </view>
</template>
<script>
export default {
	data() {
		return {
      selectSession: ''
		}
	},
	mounted() {
    this.getSession();
	},
	methods: {
		goMap() {
      wx.getLocation({
        type: 'wgs84', 
        success: function (res) {
          wx.openLocation({//​使用微信内置地图查看位置。
            latitude: 31.206924,//要去的纬度-地址
            longitude: 121.439934,//要去的经度-地址
            scale: 18,
            name: "Septième",
            address: '上海市徐汇区武康路129-1号'
          })
        }
      })
    },
    async getSession() {
      let res = await this.$u.api.TASAKIBOOKAPI.getSession();
      let selectSession = res.data.find(item =>{
        return item.id === this.vuex_userInfo.session_id
      })
      this.$u.vuex("vuex_sessionInfo", {
        session_id: selectSession.id,
        session_date: selectSession.start_date.replace("-",'年').replace("-",'月') + '日',
        session_time: selectSession.start_at.split(" ")[1].slice(0, 5) + '-' + selectSession.end_at.split(" ")[1].slice(0, 5)
      });
    },
	}
}
</script>
<style scoped lang="scss">
	.book-result-page {
		.banner {
			width: 100%;
			height: auto;
		}
		.user-info {
			padding: 50rpx;
			display: flex;
			flex-flow: column;
			justify-content: center;
			align-items: center;
			text {
				color: #000;
				font-family: HiraginoSansGB-W3;
			}
			text:nth-child(1) {
				font-size: 35rpx;
				font-weight: 600;
				margin: 30rpx 0;
			}
			text:nth-child(2) {
				margin-bottom: 10rpx;
			}
			.address {
				margin-top: 50rpx;
				width: 350rpx;
				height: auto;
			}
		}
	}
</style>
